package com.aisile.crowd_funding;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @标题 swagger2
 * @作者 Mr.chen
 * @创建日期 2018/12/18 10:51
 * @版本号 1.0
 **/
@Configuration
@EnableSwagger2
public class swagger2 {

    @Bean
    public Docket createDocket(){
        return new Docket(DocumentationType.SWAGGER_2)//文档类型
                .apiInfo(apiInfo())//api基本信息
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.aisile.crowd_funding.api.controller"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo apiInfo(){
        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        apiInfoBuilder.title("爱思乐众筹后台接口文档");
        apiInfoBuilder.contact(new Contact("Mrchen","chenjin.net.cn","271230175@qq.com"));
        apiInfoBuilder.description("用于前后端分离，后台的接口描述,仅供前后台技术人员使用");
        apiInfoBuilder.version("1.0");
        return apiInfoBuilder.build();
    }


}
